package com.fm.app03.Service.float_service;

import static com.fm.app03.Service.float_service.FloatingWidgetService.Float_view;

import android.annotation.SuppressLint;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.fm.app03.R;
import com.yhao.floatwindow.ViewStateListener;

public class MyViewStateListener implements ViewStateListener {

    public static int shouzhi_X = 500;
    public static int shouzhi_y = 500;

    @SuppressLint("SetTextI18n")
    @Override
    public void onPositionUpdate(int x, int y) {
        // 当悬浮窗口位置更新时的回调
        shouzhi_X=x+40;
        shouzhi_y=y+80;
        TextView viewById = Float_view.findViewById(R.id.switch_button3);
        viewById.setText("("+shouzhi_X+","+shouzhi_y+")");
        Log.i("TAG", "onPositionUpdate: "+shouzhi_X+" "+shouzhi_y);
    }

    @Override
    public void onShow() {
        onPositionUpdate(shouzhi_X-40,shouzhi_y-80);
        // 当悬浮窗口显示时的回调
    }

    @Override
    public void onHide() {
        // 当悬浮窗口隐藏时的回调
    }

    @Override
    public void onDismiss() {

    }

    @Override
    public void onMoveAnimStart() {

    }

    @Override
    public void onMoveAnimEnd() {

    }

    @Override
    public void onBackToDesktop() {

    }

    // 可以根据需要实现其他回调方法
}
